<html>
  <head>
    <script src="jquery.min.js"></script>
	<script src="bg.js"></script>
	<script>
	chrome.runtime.onMessage.addListener(
		function(request, sender, sendResponse) {
			if(request.type==0){
				userId = request.act_user;
				jsonpURL = "http://kuzditomi.zxq.net/hunsub/?json&blocker="+userId+"&callback=?";
				$.getJSON(jsonpURL, function(data) {
					var resp=[];
					$.each(data, function(key,val) {
						resp.push(val);
					});
					sendResponse({blocked_users: resp});
				});
			}
			else if(request.type==1){
				userId = request.act_user;
				jsonpURL = "http://kuzditomi.zxq.net/hunsub/?json&add&blocker="+request.act_user+"&blocked="+request.blocked_user+"&callback=?";
				$.getJSON(jsonpURL, function(data) {
					var resp=[];
					$.each(data, function(key,val) {
						resp.push(val);
					});
					sendResponse({blocked_users: resp});
				});
			}
			else if(request.type==2){
				userId = request.act_user;
				jsonpURL = "http://kuzditomi.zxq.net/hunsub/?json&remove&blocker="+request.act_user+"&blocked="+request.unblock_user+"&callback=?";
				$.getJSON(jsonpURL, function(data) {
					var resp=[];
					$.each(data, function(key,val) {
						resp.push(val);
					});
					sendResponse({blocked_users: resp});
				});
			}
		}
	);
	</script>
  </head>
</html>